##############  基础镜像 #####################
FROM openjdk:7u221-jdk-slim as base
ARG SERVER_NAME
ENV SERVER_NAME ${SERVER_NAME}
ENV TZ Asia/Shanghai
ADD ${SERVER_NAME}.tar.gz /
COPY wait-for-it.sh /usr/local/bin/wait-for-it.sh
RUN  chmod +x /usr/local/bin/wait-for-it.sh  \
     && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

WORKDIR /${SERVER_NAME}

##############  AionLoginServer 镜像 #####################
FROM base as loginserver
ENTRYPOINT  wait-for-it.sh mysql:3306 -s -t 0 -- java -Xms64m -Xmx256m -server -cp ./libs/*:AL-Login.jar com.aionemu.loginserver.LoginServer


##############  AionChatServer 镜像 #####################
FROM base as chatserver
ENTRYPOINT  wait-for-it.sh mysql:3306 -s -t 0 -- java -Xms128m -Xmx256m -server -cp ./libs/*:AL-Chat.jar com.aionemu.chatserver.ChatServer


##############  AionGameServer 镜像 #####################
FROM base as gameserver
ADD update.tar.gz /
ENTRYPOINT  wait-for-it.sh mysql:3306 -s -t 0 -- java -Xms2048m -Xmx8192m -XX:MaxHeapSize=8192m -Xdebug -XX:MaxNewSize=48m -XX:NewSize=48m -XX:+UseParNewGC -XX:+CMSParallelRemarkEnabled -XX:+UseConcMarkSweepGC -XX:-UseSplitVerifier -ea -javaagent:./libs/al-commons-1.0.jar -cp ./libs/*:./libs/AL-Game.jar com.aionemu.gameserver.GameServer




